﻿using System;
using System.Windows.Forms;
using SmartDeviceProject1.Forms;

namespace SmartDeviceProject1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void spend_Click(object sender, EventArgs e)
        {
            Accounting(sender, e, true);
        }

        private void earn_Click(object sender, EventArgs e)
        {
            Accounting(sender, e, false);

        }
        private void Accounting(object sender, EventArgs e, bool isSpend)
        {
            AccountFormBase accountForm = new AccountFormBase(isSpend?CategoryType.Spend:CategoryType.Earn);
            accountForm.Show();
        }

        private void categorySpend_Click(object sender, EventArgs e)
        {
            CategoryForm cateForm = new CategoryForm(CategoryType.Spend);
            cateForm.ShowDialog();
        }

        private void runningAccount_Click(object sender, EventArgs e)
        {
            RunningAccounts form = new RunningAccounts();
            form.ShowDialog();
        }

        private void categoryEarn_Click(object sender, EventArgs e)
        {
            CategoryForm cateFrom = new CategoryForm(CategoryType.Earn);
            cateFrom.ShowDialog();
        }
    }
}